<style lang="less">
@import '../../../styles/common.less';
</style>

<template>
    <Card style="height:900px">
        <div v-if="isTrial=='1' ">
            <div style="margin-left: 42%;">
                <div style="margin-top:30px">
                    <div style="float:left;width:140px">合同Id：</div>
                    <div>
                        <Input v-model="settleTrialResult.loanId" style="width: 150px" :disabled="true" />
                    </div>
                </div>
                <div style="margin-top:30px">
                    <div style="float:left;width:140px">客户姓名：</div>
                    <div>
                        <Input v-model="settleTrialResult.custName" style="width: 150px" :disabled="true" />
                    </div>
                </div>
                <div style="margin-top:30px">
                    <div style="float:left;width:140px">证件号码：</div>
                    <div>
                        <Input v-model="settleTrialResult.custIdNumber" style="width: 150px" :disabled="true" />
                    </div>
                </div>
                <div style="margin-top:30px">
                    <div style="float:left;width:140px">合同开始时间：</div>
                    <div>
                        <Input v-model="settleTrialResult.contractBeginDate" style="width: 150px" :disabled="true" />
                    </div>
                </div>
                <div style="margin-top:30px">
                    <div style="float:left;width:140px">贷款金额：</div>
                    <div>
                        <Input v-model="settleTrialResult.loanAmount" style="width: 150px" :disabled="true" />
                    </div>
                </div>
                <div style="margin-top:30px">
                    <div style="float:left;width:140px">应还金额：</div>
                    <div>
                        <Input v-model="settleTrialResult.repaymentAmount" style="width: 150px" :disabled="true" />
                    </div>
                </div>
                <div style="margin-top:30px">
                    <div style="float:left;width:140px">应还本金：</div>
                    <div>
                        <Input v-model="settleTrialResult.repaymentPrincipal" style="width: 150px" :disabled="true" />
                    </div>
                </div>
                <div style="margin-top:30px">
                    <div style="float:left;width:140px">应还利息：</div>
                    <div>
                        <Input v-model="settleTrialResult.repaymentInterest" style="width: 150px" :disabled="true" />
                    </div>
                </div>
                <div style="margin-top:30px">
                    <div style="float:left;width:140px">应还违约金额：</div>
                    <div>
                        <Input v-model="settleTrialResult.repaymentPenaltyFee" style="width: 150px" :disabled="true" />
                    </div>
                </div>
                <div style="margin-top:30px">
                    <div style="float:left;width:140px">应还罚息：</div>
                    <div>
                        <Input v-model="settleTrialResult.repaymentFine" style="width: 150px" :disabled="true" />
                    </div>
                </div>
                <div style="margin-top:30px">
                    <div style="float:left;width:140px">应还复利:</div>
                    <div>
                        <Input v-model="settleTrialResult.repaymentCompoundInterest" style="width: 150px" :disabled="true" />
                    </div>
                </div>
            </div>
            <div style="margin-top: 40px;text-align:center">
                <Button type="primary" @click="settleTrial">提前结清</Button>
                <Button type="primary" @click="goBack">返回</Button>
            </div>
        </div>

        <div v-if="isTrial=='2' ">
            <div style="margin-left: 42%;">
                <div style="margin-top:30px">
                    <div style="float:left;width:140px">合同Id：</div>
                    <div>
                        <Input v-model="settleTrialResult.loanId" style="width: 150px" :disabled="true" />
                    </div>
                </div>
                <div style="margin-top:30px">
                    <div style="float:left;width:140px">客户姓名：</div>
                    <div>
                        <Input v-model="settleTrialResult.custName" style="width: 150px" :disabled="true" />
                    </div>
                </div>
                <div style="margin-top:30px">
                    <div style="float:left;width:140px">证件号码：</div>
                    <div>
                        <Input v-model="settleTrialResult.custIdNumber" style="width: 150px" :disabled="true" />
                    </div>
                </div>
                <div style="margin-top:30px">
                    <div style="float:left;width:140px">合同开始时间：</div>
                    <div>
                        <Input v-model="settleTrialResult.contractBeginDate" style="width: 150px" :disabled="true" />
                    </div>
                </div>
                <div style="margin-top:30px">
                    <div style="float:left;width:140px">贷款金额：</div>
                    <div>
                        <Input v-model="settleTrialResult.loanAmount" style="width: 150px" :disabled="true" />
                    </div>
                </div>
                <div style="margin-top:30px">
                    <div style="float:left;width:140px">申请结果:</div>
                    <div>
                        <Input v-model="settleTrialResult.applyResult" style="width: 150px" :disabled="true" />
                    </div>
                </div>
            </div>
            <div style="margin-top: 40px;text-align:center">
                <Button type="primary" @click="goBack">返回</Button>
            </div>
        </div>
    </Card>
</template>

<script>
export default {
  name: 'mutative-router',
  data () {
    return {
      isTrial: '1',
      settleTrialResult: {
        loanId: '',
        custName: '',
        custIdNumber: '',
        contractBeginDate: '',
        loanAmount: '',
        repaymentAmount: '',
        repaymentPrincipal: '',
        repaymentInterest: '',
        repaymentPenaltyFee: '',
        repaymentFine: '',
        repaymentCompoundInterest: '',
        applyResult: '',
        fjAmount: ''
      }
    }
  },
  computed: {
    avatorImage () {
      return localStorage.avatorImgPath
    }
  },

  created () {
    // 初始化当前页面请求对象实例
    var vm = this
    this.$ajax = this.$util.ajax()
    vm.settleTrialResult = this.$route.params.data
    vm.dataQuery()
  },

  methods: {
    dataQuery () {
      var vm = this
      this.$ajax.post(this.$appContext.marvels_core_financial + 'financial/fund/mtTrail/service/applyOperate', vm.settleTrialResult).then(re => {
        var data = re.data
        vm.settleTrialResult = data.data
      }).catch(er => {

      })
    },
    settleTrial () {
      var vm = this
      this.$Modal.confirm({
        content: '是否提前结清?',

        okText: '是',

        cancelText: '否',
        onOk: () => {
          this.$ajax.post(this.$appContext.marvels_core_financial + 'financial/fund/mtTrail/service/settleTrial', vm.settleTrialResult).then(re => {
            var data = re.data
            vm.settleTrialResult = data.data
            vm.isTrial = '2'
          }).catch(er => {

          })
        }
      })
    },
    goBack () {
      this.$router.push({ name: 'mt-ahead-settle-trial' })// 类似post传参
    }
  }
}
</script>
